package com.tqjc.system.common.entity.BO;

import com.tqjc.business.interactivewithscan.entity.Coord;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.jetbrains.annotations.NotNull;

/**
 * @description: 落地位置信息
 * @Author: 86195
 * @Date: 2024/1/2 20:03
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DropPosition implements Comparable<DropPosition>{

    private Double x;

    private Double y;

    private Double z;

    private Integer count;


    public DropPosition(int x, int y, int z) {
        this.x = Double.valueOf(x);
        this.y = Double.valueOf(y);
        this.z = Double.valueOf(z);
    }

    public String getIndexInfo(){
        StringBuilder sb = new StringBuilder();
        sb.append("X:").append(this.getX()).append(",Y:").append(this.getY()).append(",Z:").append(this.getZ());
        return sb.toString();
    }

    @Override
    public String toString() {
        return "DropPosition{" +
                "x=" + x +
                ", y=" + y +
                ", z=" + z +
                ", count=" + count +
                '}';
    }

    public Coord toCoord(){
        int x = (int) (this.x * 100);
        int y = (int) (this.y * 100);
        int z = (int) (10624);
        return new Coord(x,y,z);

    }

    @Override
    public int compareTo(@NotNull DropPosition o) {
        if(this.getZ() > o.getZ()){
            return 1;
        }
        return -1;
    }
}
